package main

import (
	"os"
	"io"
)

const BUFF_SIZE=64
var buff []byte

func cat(rd io.Reader) {
	for {
		if readn,readerr:=rd.Read(buff); readn > 0 {
			os.Stdout.Write(buff[:readn])
		} else if readerr!=nil {
			if readerr!=io.EOF {
				os.Stderr.WriteString(readerr.Error())
			}
			break
		}
	}
}

func main() {
	buff=make([]byte, BUFF_SIZE)

	args:=os.Args[1:]
	arglen:=len(args)
	if arglen>0 {
		for i:=0; i<arglen; i++ {
			file,fileerr:=os.Open(args[i])
			if fileerr!=nil {
				os.Stderr.WriteString(fileerr.Error())
				continue
			}
			cat(file)
		}
	} else {
		cat(os.Stdin)
	}
}
